package com.example.rabbitmq8.controller;

import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RequestMapping("/producer")
@RestController
public class ProducerController {
    @Autowired
    private RabbitTemplate rabbitTemplate;
    @RequestMapping("/test")
    public String test() {
        rabbitTemplate.convertAndSend("","quorum.queue","rabbitmq haproxy");
        return "消息发送成功";
    }
}
